#include <iostream>
#include "krpc/sync.h"
#include "krpc/localstream.h"

int main(int argc, char **argv)
{
	if (argc != 3) {
		std::cerr << "please input 2 argument for topic and data!" << std::endl;
		return -1;
	}
	std::string topic = argv[1];
	std::string data = argv[2];
	KRPC::LOCALSTREAM com("msgcenter");
	KRPC::SyncFunc<void(const std::string &, const std::string &)> func("publish", com, 3000);
	
	auto op = func(topic, data);
	if (op)
		std::cout << "echo succ" << std::endl;
	else
		std::cout << "echo fail" << std::endl;
	return 0;
}